/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.aptech.campaign.entities;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
 *
 * @author Tai Nguyen
 */
public class TypeCampaign {

    private int typeID;
    private String typeName;
    private float costForDay;
    private String lastError;

    /**
     *
     * @return boolean
     */
    public boolean validate() {
        Pattern pattern = Pattern.compile("[0-9]+[.]?[0-9]+");
        Matcher m = pattern.matcher(String.valueOf(costForDay));
        if (!m.matches()) {
            setLastError("Please enter numeric value for CostForDay!");
            return false;
        }
        return true;

    }

    /**
     * @return the typeID
     */
    public int getTypeID() {
        return typeID;
    }

    /**
     * @param typeID the typeID to set
     */
    public void setTypeID(int typeID) {
        this.typeID = typeID;
    }

    /**
     * @return the typeName
     */
    public String getTypeName() {
        return typeName;
    }

    /**
     * @param typeName the typeName to set
     */
    public void setTypeName(String typeName) {
        this.typeName = typeName;
    }

    /**
     * @return the costForDay
     */
    public float getCostForDay() {
        return costForDay;
    }

    /**
     * @param costForDay the costForDay to set
     */
    public void setCostForDay(float costForDay) {
        this.costForDay = costForDay;
    }

    /**
     * @return the lastError
     */
    public String getLastError() {
        return lastError;
    }

    /**
     * @param lastError the lastError to set
     */
    public void setLastError(String lastError) {
        this.lastError = lastError;
    }
}
